
//1. 声明当前状态对应的 reducer 函数
// action  
  // {type: 'incre', payload: 1} {type: 'incre', payload: 10}
  // {type: 'decre', payload: 1}
let zanReducer = (state=0, action) => {
  switch(action.type){
    case 'incre':
      return state + action.payload;
    case 'decre':
      return state - action.payload;
    default:
      return state;
  }
}

export default zanReducer;

//2. 声明 action creator
export let increAction = payload => ({type: 'incre', payload}); 
export let decreAction = payload => ({type: 'decre', payload}); 